package com.example.demo.mqclient;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description
 * User: 杰
 * Date: 2023 -08 -04
 * Time: 21:57
 */
// 该类就是一个连接工厂
public class ConnectionFactory {
    // broker server 的 ip地址
    private String host;
    // broker server 的 端口号.
    private int port;

    // 访问 broker server 的那个虚拟主机
    // 下列几个属性没有使用
    // private String virtualHostName;
    // private String userName;
    // private String password;

    public Connection newConnection() throws IOException {
        Connection connection = new Connection(host,port);
        return connection;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
